﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MUD.Network;
using MUD.Driver.Log;
using MUD.Lib.Utils;

namespace MUD.Driver
{
    public partial class ActiveConnections : Form
    {

        SocketServer Server;
        public ActiveConnections()
        {
            InitializeComponent();

        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            Close();
        }

        internal void PopulateListBox(SocketServer server)
        {
            Server = server;
            foreach (AsyncClient client in server.Clients)
            {
                listConnections.Items.Add(client);
            }
        }

        private void btnTest_click(object sender, EventArgs e)
        {
            foreach (AsyncClient client in Server.Clients)
            {
                if (client == listConnections.SelectedItem)
                {
                    client.Write(ANSI.ColorCode(ANSI.Codes.Reset) + "This is" + ASCIIEncoding.ASCII.GetString(new byte[] {0}) + "a test!" + Environment.NewLine + ANSI.ColorCode(ANSI.Codes.Reset));
                    break;
                }
            }
        }


    }
}
